<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j">
	
<body> 
 <ui:composition template="/templates/default/template.xhtml">
    <ui:define name="body">
     <h:panelGrid columns="1" style="margin-left:30px;width:100%">
    	<!--  tieu de -->
    	<h:panelGrid columns="3" styleClass="columPanelbaritemTitle">
					<h:graphicImage value="/templates/default/images/left-heading_01.jpg" style="margin-left:-4px;margin-bottom:0px"></h:graphicImage>
			  		<h:outputText value="Sửa thông tin đoàn ra" styleClass="panelbaritemTitle"></h:outputText>
					<h:graphicImage value="/templates/default/images/left-heading_03.jpg"></h:graphicImage>
		 </h:panelGrid>
	  	<!-- ket thuc tieu de -->
		<!-- phan noi dung phia duoi -->	  
    	<h:panelGrid columns="1" styleClass="panelGridBody">
    			<!-- Bat dau noi dung ben trong -->
		    <rich:panel style="background:#FFFFFF" id="out">
		    <h:form id="taomoidoanra">   
   	    	<h:panelGrid columns="1" style="margin-left:13px;">
		      		<h:outputText id="idError" value="#{doanRa.error}" style=" color: red;"></h:outputText>
			</h:panelGrid>			
			<h:panelGrid columns="4" style="margin-left:13px;">
					<h:outputText value="Mã đoàn(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="text" value="#{doanRa.maDoan}" style="margin-left:15px;" size="20"/>
		    <h:panelGrid columns="1">
							<rich:suggestionbox  id="suggestionBoxId" for="text" tokens=",["
			                rules="#{suggestionBoxSua.rules}"
			                suggestionAction="#{suggestionBoxSua.autocomplete}" var="result"
			                fetchValue="#{result.text}" rows="#{suggestionBoxSua.intRows}"
			                first="#{suggestionBoxSua.intFirst}"
			                minChars="#{suggestionBoxSua.minchars}"
			                shadowOpacity="#{suggestionBoxSua.shadowOpacity}"
			                border="#{suggestionBoxSua.border}" width="#{suggestionBoxSua.width}"
			                height="#{suggestionBoxSua.height}"
			                shadowDepth="#{suggestionBoxSua.shadowDepth}"
			                cellpadding="#{suggestionBoxSua.cellpadding}">			            
		                <h:column styleClass="inputText">
		                    <h:outputText value="#{result.text}" styleClass="inputText"/>
		                </h:column>
                  </rich:suggestionbox>
		    	 </h:panelGrid>	
		    		<a4j:commandButton type="Button" value="Tìm theo mã" styleClass="Button" action="#{doanRa.timKiemTheoMa}">
		       		</a4j:commandButton>
		       	</h:panelGrid>		
		      	<h:panelGrid columns="2" style="margin-left:13px;">
		       		<h:outputText value="Loại đoàn(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="loaiDoan" value="#{doanRa.loaiDoan}" size="20"/>
		    		
		    		<h:outputText value="Nước đến(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="nuocDen" value="#{doanRa.nuocDen}" size="20"/>
		    	
		    		<h:outputText value="Lĩnh vực(*) : " style="margin-left:20px;"  styleClass="inputText" ></h:outputText>
		    		<h:selectOneMenu value="#{doanRa.linhVuc}" style="margin-left:0px;" styleClass="InputControl">
				    	<f:selectItems  value="#{truyXuat.listItemLinhVuc}">				    
				    	</f:selectItems>	
				    	<a4j:support event="onchange" reRender="idout1" 
						action="#{doanRa.locTheoLinhVucSua}"/>
		    		</h:selectOneMenu>		 
		    		   		
		       		<h:outputText value="Mục đích(*) :" id="idout1" style="margin-left:20px;" styleClass="inputText" >
		       		</h:outputText>
		       	   	<h:selectOneMenu value="#{doanRa.mucDich}"  style="margin-left:0px;" styleClass="InputControl">
				    <f:selectItems  value="#{doanRa.listMucDich}"/>	
		    		</h:selectOneMenu>	
		    				    	  		    	
		       		<h:outputText value="Ngày đi(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       		<rich:calendar popup="true" id="ngayDi" size="5px" value="#{doanRa.ngayDi}" datePattern="dd/MM/yyyy" currentDate="#{doanRa.ngayDi}">
					</rich:calendar>
				
					<h:outputText value="Ngày về(*): " style="margin-left:20px;" styleClass="inputText"></h:outputText>
			  		<rich:calendar popup="true" id="ngayVe" size="5px" value="#{doanRa.ngayVe}" datePattern="dd/MM/yyyy" currentDate="#{doanRa.ngayVe}">
					</rich:calendar>
					
					<h:outputText value="Số QĐ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="soQuyetDinh" value="#{doanRa.soQuyetDinh}" size="20"/>
		    		
			  		<h:outputText value="Ngày ký QĐ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
			  		<rich:calendar popup="true" id="ngayKyQuyetDinh" size="5px" value="#{doanRa.ngayKyQuyetDinh}" datePattern="dd/MM/yyyy" currentDate="#{doanRa.ngayKyQuyetDinh}">
					</rich:calendar>					
					</h:panelGrid>		
					
					<h:panelGrid columns="4" style="margin-left:13px;">
		      			<h:outputText value="Kinh phí: " style="margin-left:20px;"  styleClass="inputText" ></h:outputText>
		    			<h:inputText id="kinhPhi"  style="margin-left:34px;" value="#{doanRa.kinhPhi}" size="20" />
						<h:outputText value="Báo cáo kết quả: "  styleClass="inputText" style="margin-left:15px;"></h:outputText>
		    			<h:selectBooleanCheckbox value="#{doanRa.baoCao}">
               			</h:selectBooleanCheckbox>					
		      		</h:panelGrid>	
		      					
					<h:panelGrid columns="2" style="margin-left:10px;">
					<h:outputText value="Người ký QĐ(*):"  style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="nguoiKyQuyetDinh" style="margin-left:0px;" value="#{doanRa.nguoiKyQuyetDinh}" size="20"/>
		    		<h:outputText value="Đơn vị mời(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="donViMoi" value="#{doanRa.donViMoi}" style="margin-left:0px;" size="48"/>
		  			</h:panelGrid>	
		  
					<h:panelGrid columns="3" style="margin-left:190px;margin-top:10px;margin-bottom:1px">
					<a4j:commandButton type="Button" value="Tìm mở rộng" styleClass="Button" action="#{doanRa.timKiemMoRong}">
		       		</a4j:commandButton>
			    	<a4j:commandButton value="Cập nhật" disabled="#{doanRa.maDoan == null}" size="15" styleClass="Button" action="#{doanRa.capNhatDoanRa}">
			    	</a4j:commandButton>
			    	<a4j:commandButton type="Button" value="Hiển thị tấc cả" styleClass="Button" action="#{doanRa.displayAll}">
		       		</a4j:commandButton>	
			        </h:panelGrid>	   
			      </h:form> 	
		</rich:panel>		
		 
			     <h:panelGrid columns="1" style="margin-left:0px;">		       		
		       		<h:outputText value="Danh sách đoàn ra " styleClass="inputText" ></h:outputText>		       			    		
				</h:panelGrid>
				 
			<!-- Bat dau table -->
					<h:form>
			
					<h:dataTable id="list" value="#{doanRa.dsDoanRa}" var="Item" 
								columnClasses="column" headerClass="TableHeader" rowClasses="ROW1,ROW2" footerClass="TableFooter" 
					       style="width:100%; margin-left:0px;margin-top: 10px" cellspacing="1px;" rows="10">
						<h:column >
							<f:facet name="header">
								<h:outputText value="STT"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.stt}"></h:outputText>
							<f:facet name="footer">
								<rich:spacer></rich:spacer>
							</f:facet>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Mã đoàn"></h:outputText>
							</f:facet>
							<a4j:commandLink action="#{doanRa.timKiemTheoLink}">
							<h:outputText value="#{Item.maDoanRa}"></h:outputText>
								<f:param name="lnkMaDoan" value="#{Item.maDoanRa}" />
							</a4j:commandLink>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Loại đoàn"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.loaiDoanRa}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Nước đến"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.nuocDen}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Ngày đi"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.ngayDi}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Ngày về"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.ngayVe}"></h:outputText>
						</h:column>			
								
						<h:column>
							<f:facet name="header">
								<h:outputText value="Cập nhật thành viên"></h:outputText>
							</f:facet>
							 <a4j:commandLink action="#{doanRa.capNhatThanhVien}">
							 	<h:graphicImage value="/qldoanra/func01/images/icoMember.gif"></h:graphicImage>
							 	<f:param name="maDoan_TV" value="#{Item.maDoanRa}" />							 								 	
							 </a4j:commandLink>
						</h:column>
					</h:dataTable>
						<!-- phan trang -->
						<rich:datascroller align="right"  for="list" maxPages="15" />
						<!-- ket thuc phan trang -->
				</h:form>
    </h:panelGrid>
   </h:panelGrid>

 </ui:define>
</ui:composition> 
</body>	
</html>